﻿using System.Drawing;
using SBIP;
using SBIP.Filter;
using System.Drawing.Imaging;
namespace TestSBIP_3._1
{
    class Program
    {
        static void Main()
        {
            Bitmap image = new Bitmap("Cathedral.jpg");
            Nail.Stopwatch.Start();
            // 1. Offline rendering
            // create Processor, used as rendering framework
            Processor processor = new Processor();
            // starts Processor
            processor.Begin(image);
            // create FixedGaussianBlur filter
            CannyEdgeDetector filter = new CannyEdgeDetector();
            processor.Filter = filter;
            filter.HighThreshold = 40;
            filter.BlackWhite = true;
            //filter.Version = FixedGaussianBlur.Versions.Strong;
            // apply the filter, render to bitmap  
            Bitmap resultImage = processor.RenderToBitmap();            
            resultImage.Save("Canny-SBIP.bmp", ImageFormat.Bmp);
            // apply the filter, render to texture
            // Texture2D resultTexture = processor.RenderToTexture( );
            processor.End();
            Nail.Stopwatch.End(false);

            //processor = new Processor();
            //// 2. Online rendering
            //// create any windows control for rendering in
            //Form myForm = new Form
            //{
            //    Width = image.Width,
            //    Height = image.Height
            //};
            //// starts Processor
            ////processor.Begin( "Video.avi", myForm );
            //processor.Begin(image, myForm);
            //// create ThresholdRGB filter
            //filter = new CannyEdgeDetector();
            //processor.Filter = filter;
            ////filter.Version = FixedGaussianBlur.Versions.Strong;
            //// apply the filter
            //myForm.Show( );
            //while ( myForm.Created )
            //{
            //    processor.Render( );
            //    Application.DoEvents( );
            //}
            //processor.End( );
        }
    }
}
